package com.butterfly.vv;

import java.util.ArrayList;
import java.util.List;

import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.butterfly.vv.model.Contact;
import com.teleca.jamendo.dialog.PhoneLoadingDialog;
import com.teleca.jamendo.dialog.RegistryLoadingDialog;

import android.app.*;
import android.content.*;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.*;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.widget.*;
import android.widget.AdapterView.*;

/*
 * Listhandling inspiriert von: http://www.anddev.org/creating_a_contextmenu_on_a_listview-t2438.html
 */

public class ManageContactsActivity extends TabActivity {

    private static final String TAG = ManageContactsActivity.class.getSimpleName();
    
    private TabHost mTabHost;
    
    public static void upNolaunch(Activity c, String []query,IXmppFacade mXmppFacade){
		new RegistryLoadingDialog(c,R.string.artist_loading, R.string.artist_fail,mXmppFacade).execute(query);
	}
    
    public static void upNolaunch(Activity c, String []query,String regjid){
		new RegistryLoadingDialog(c,R.string.artist_loading, R.string.artist_fail,regjid).execute(query);
	}
    
    public static void launch(Activity c, String artistName,ContentResolver contentResolver){
		new PhoneLoadingDialog(c,R.string.artist_loading, R.string.artist_fail,contentResolver).execute(artistName);
	}
    
    public static void launch(Activity c, String artistName,ContentResolver contentResolver,String jid){
		new PhoneLoadingDialog(c,R.string.artist_loading, R.string.artist_fail,contentResolver,jid).execute(artistName);
	}

    @Override
    public void onCreate(Bundle savedInstanceState) {
        if(Log.isLoggable(TAG, Log.DEBUG))
            Log.d(TAG, "onCreate(Bundle)");
        if(Log.isLoggable(TAG, Log.VERBOSE))
            Log.v(TAG, " Bundle("+savedInstanceState+")");
        
        super.onCreate(savedInstanceState);
        
        // set up main UI
        setContentView(R.layout.phone_manager);

        // initialize access variables
        mTabHost = getTabHost();

        ArrayList<Contact> mycontacts = null;
        mycontacts = (ArrayList<Contact>)getIntent().getSerializableExtra("phoneContacts");
        ArrayList<Contact> mysimContacts = null;
        mysimContacts = (ArrayList<Contact>)getIntent().getSerializableExtra("simContacts");
        
        mTabHost.addTab(mTabHost.newTabSpec("tab_phone").setIndicator(getString(R.string.phone_tab_title)).setContent(new Intent(this,Share_Phono_Ex_checkboxActivity.class).setAction("com.btf.PHONE").putExtra("phoneContacts", mycontacts)));
       // mTabHost.addTab(mTabHost.newTabSpec("tab_simcard").setIndicator(getString(R.string.sim_tab_title)).setContent(new Intent(this,SelectedListActivity.class).setAction("com.btf.SIM").putExtra("simContacts", mysimContacts)));
        mTabHost.addTab(mTabHost.newTabSpec("tab_simcard").setIndicator(getString(R.string.sim_tab_title)).setContent(new Intent(this,Share_Phono_Ex_checkboxActivity.class).setAction("com.btf.SIM").putExtra("simContacts", mysimContacts)));
        // start with phone tab
        mTabHost.setCurrentTab(0);

        
    }
    
   
}